import java.util.Scanner;

/**
 * @Author: YCKOKO
 * @Date: 2023-05-19
 * @Time:13:28
 * @Description:
 */
public class demo2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        String s = Integer.toString(num, 2);
        int count = 0;
        int start = 0;
        int end = 0;
        while (end < s.length()) {
            if (s.charAt(end) == '1') {
                count = Math.max(end - start + 1, count);
                end++;
            } else {
                end++;
                start = end;
            }
        }
        System.out.println(count);
    }
}
